home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d13 / qptech.arc / TI393.ASC < prev    next >
Text File  |  1991-04-25  |  7KB  |  265 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. PRODUCT  :  QUATTRO PRO                            NUMBER  :  393
  8. VERSION  :  1.0
  9.      OS  :  DOS
  10.    DATE  :  August 10, 1990                 PAGE  :  1/4
  11.  
  12.   TITLE  :  DELREAD:  A MACRO FOR IMPORTING ASCII
  13.               DELIMITED FILES
  14.  
  15.  
  16.  
  17.  
  18. DELREAD provides a means for importing ASCII delimited files
  19. longer than 256 characters into Quattro Pro.  It even allows you
  20. to define the type of delimiters used in your file.  The DELREAD
  21. macro is centered around a Main Menu.
  22.  
  23.             The DELREAD Menu
  24.  
  25.           ╔═══════════════════════════════════╗
  26.           ║  Only Commas Import          ║
  27.           ║  Comma & Quote Delimited Import   ║
  28.           ║  X & Y Delimited Import           ║
  29.           ║  Quit                  ║
  30.           ╚═══════════════════════════════════╝
  31.  
  32. Menu Item                  Description
  33. ═════════════════════════════════════════════════════════════════
  34. Only Commas Import           Imports a file in which the
  35.                    fields are separated by
  36.                    commas.
  37.  
  38.                    Example:   1,alpha,beta
  39.                           2,3,4,5,6
  40.  
  41. Comma & Quote Delimited Import       Imports a file in which the
  42.                    fields are separated by
  43.                    commas, and labels are
  44.                    enclosed by quotes (").
  45.  
  46.                    Example:   1,"alpha","beta"
  47.                           2,3,4,5,6
  48.  
  49. X & Y Delimited Import           Imports a file in which the
  50.                    fields are separated by the
  51.                    symbol X (which you define),
  52.                    and labels are enclosed by the
  53.                    symbol Y (which you also
  54.                    define).
  55.  
  56.                    Example:   1XYalphaYXYbetaY
  57.                           2X3X4X5X6
  58.  
  59. Quit                   Exits the macro.
  60. ═════════════════════════════════════════════════════════════════
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. PRODUCT  :  QUATTRO PRO                            NUMBER  :  393
  74. VERSION  :  1.0
  75.      OS  :  DOS
  76.    DATE  :  August 10, 1990                 PAGE  :  2/4
  77.  
  78.   TITLE  :  DELREAD:  A MACRO FOR IMPORTING ASCII
  79.               DELIMITED FILES
  80.  
  81.  
  82.  
  83.  
  84. How to enter this macro:
  85.  
  86.    1.  Open a blank spreadsheet.
  87.  
  88.    2.  Type the following labels into the cells listed next to
  89.        them:
  90.  
  91.        TEMP         A1
  92.        CURRENT         A2
  93.        HOME         A3
  94.        COLCOUNT          A4
  95.        POSITION          A5
  96.        DELIMITER     A6
  97.        FILENAME          A7
  98.        QUOTE         A8
  99.        PRINTED?          A9
  100.        \I        A11
  101.        IMPORTER         A13
  102.        IMPORT        A19
  103.        LOOP        A24
  104.        OUTPUTCELL    A30
  105.        OUTPUTLABEL    A38
  106.        FINISH        A44
  107.        NEXTLINE         A49
  108.        OUTPUTLABEL_NL    A59
  109.  
  110.    3.  Issue the command </><Edit><Names><Labels><Right>, type
  111.        A1..A59 when prompted for the block, and press <ENTER>.
  112.        This creates all of the block names the macro will need in
  113.        order to execute properly.
  114.  
  115.    4.  Type in the macro commands listed under "The DELREAD
  116.        Macro."    Do not worry if some of the formulas entered
  117.        display ERR.  The macro will recalculate them as it
  118.        proceeds through the import.
  119.  
  120.    5.  Select:    </><Tools><Macro><Library><Yes>.
  121.  
  122.    6.  Save the file with a file extension of .WQ1 or .WQ! (for
  123.        example, DELREAD.WQ!.  Now the DELREAD macro is ready for
  124.        use.
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139. PRODUCT  :  QUATTRO PRO                            NUMBER  :  393
  140. VERSION  :  1.0
  141.      OS  :  DOS
  142.    DATE  :  August 10, 1990                 PAGE  :  3/4
  143.  
  144.   TITLE  :  DELREAD:  A MACRO FOR IMPORTING ASCII
  145.               DELIMITED FILES
  146.  
  147.  
  148.  
  149.  
  150.    7.  Bring up the spreadsheet you wish to import data into
  151.        using </><File><Open>.
  152.  
  153.    8.  Move to the upper left-hand corner of the block you wish
  154.        to have the imported data placed into.
  155.  
  156.    9.  Press:  Alt-I.
  157.  
  158.   10.  The macro menu will appear and you may choose the options
  159.        which are appropriate to your situation.
  160.  
  161.  
  162.             The DELREAD Macro
  163.  
  164.  
  165. B11:  '{let printed?,0}{menubranch importer}
  166. B13:  'Only Commas Import
  167. B14:  'Import a file with fields separated by commas.
  168. B15:  '{let QUOTE,""}
  169. B16:  '{let delimiter,","}
  170. B17:  '{import}{menubranch importer}
  171. B19:  '{getlabel "Name of File to Import: ",filename}
  172. B20:  '{open filename,"r"}{beep}{beep}{branch import}
  173. B21:  '{indicate "WAIT"}{windowsoff}{paneloff}
  174. B22:  '{let colcount,0}{let current,""}{let home, @cellpointer("address")}
  175. B23:  '{branch loop}
  176. B24:  '{read 1,temp}{branch finish}
  177. B25:  '{if temp=delimiter}{branch outputcell}
  178. B26:  '{if temp=@char(10)#or#temp=@char(13)}{branch nextline}
  179. B27:  '{let current,current&temp}
  180. B28:  '{branch loop}
  181. B30:  '{recalccol b1..b65}
  182. B31:  '{if @left(@trim(current),1)=QUOTE #AND# @right( @trim(current), 1) =
  183.       QUOTE}{branch outputlabel}
  184. B32:  +"{if @iserr(@value(current))}{let "&@CELLPOINTER("address")&",
  185.       current}"
  186. B33:  +"{if #not#@iserr(@value(current))}{let "&@CELLPOINTER("address")&",
  187.       @value(current)}"
  188. B34:  '{let current,""}
  189. B35:  '{let colcount,colcount+1}
  190. B36:  '{right}{branch loop}
  191. B38:  '{recalccol b1..b65}
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205. PRODUCT  :  QUATTRO PRO                            NUMBER  :  393
  206. VERSION  :  1.0
  207.      OS  :  DOS
  208.    DATE  :  August 10, 1990                 PAGE  :  4/4
  209.  
  210.   TITLE  :  DELREAD:  A MACRO FOR IMPORTING ASCII
  211.               DELIMITED FILES
  212.  
  213.  
  214.  
  215.  
  216. B39:  +"{let "&@CELLPOINTER("address")&", @mid(current, 1,
  217.       @length(current)-2)}"
  218. B40:  '{let current,""}
  219. B41:  '{let colcount,colcount+1}
  220. B42:  '{right}{branch loop}
  221. B44:  '{panelon}{windowson}{close}{recalccol b1..b65}
  222. B45:  '{indicate}{goto}
  223. B46:  +HOME&"~"
  224. B47:  '{menubranch importer}
  225. B49:  '{recalccol b1..b65}{let printed?,0}
  226. B50:  '{if colcount=0#AND#current=""}{branch loop}
  227. B51:  '{if @left(@trim(current),1) = QUOTE #AND# @right( @trim(current), 1)
  228.       = QUOTE}{branch outputlabel_nl}
  229. B52:  +"{if @iserr(@value(current))}{let "&@CELLPOINTER("address")&",
  230.       current}{let printed?, 1}"
  231. B53:  +"{if #not# @iserr(@value(current))}{let "&@CELLPOINTER("address")&",
  232.       @value(current)}{let printed?, 1}"
  233. B54:  +"{if printed?=0}{let "&@CELLPOINTER("address")&",current}"
  234. B55:  '{let current,""}{left colcount}
  235. B56:  '{let colcount,0}
  236. B57:  '{down}{branch loop}
  237. B59:  '{recalccol b1..b65}
  238. B60:  +"{let "&@CELLPOINTER("address")&", @mid(current, 1,
  239.       @length(current)-2)}"
  240. B61:  '{let current,""}{left colcount}
  241. B62:  '{let colcount,0}
  242. B63:  '{down}{branch loop}
  243. C13:  'Comma & Quote Delimited Import
  244. C14:  'Import file with comma separated fields, and labels in quotes.
  245. C15:  '{let QUOTE,""""}
  246. C16:  '{let delimiter,","}
  247. C17:  '{import}{menubranch importer}
  248. D13:  'X & Y Delimited Import
  249. D14:  'Import file with X separated fields, and labels in Y's.
  250. D15:  '{getlabel "Enter the symbol which separates fields: ", delimiter}
  251. D16:  '{getlabel "Enter the symbol which encloses labels: ",QUOTE}
  252. D17:  '{import}{menubranch importer}
  253. E13:  'Quit
  254. E14:  'Exit the macro
  255. E15:  '{quit}
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.